{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "WORLD操作入门"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "import librosa\n",
    "import pyworld as pw\n",
    "import librosa.display\n",
    "from matplotlib import pyplot as plt\n",
    "import soundfile\n",
    "import argparse"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "filename = './data/demo.wav'\n",
    "x, fs = soundfile.read(filename)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "原始音频"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<audio  controls=\"controls\" src=\"./data/demo.wav\" ></audio>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAADQCAYAAADF5VICAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3dd3xT5fcH8M/ppoPRwZBSykb2KHvIniq4cf0UBy4QRP1awcFw4MKtiAscgCi4KHuDzFL2LlCgUGjLKLTQ/fz+SFLSNmnT5CbPc5Pzfr14kXGbe9Im99z7jPOQEAKMMcYYU5uX7AAYY4wxVj5O2IwxxpgOcMJmjDHGdIATNmOMMaYDnLAZY4wxHeCEzRhjjOmAj+wAyhIeHi6io6Nlh8EYY4y5xI4dO9KFEBGWntMkYRPRIACfAvAG8J0QYpqV7ToA2ALgPiHEH+W9bnR0NOLj47UIkTHGGFMeEZ209pzDTeJE5A3gSwCDATQDcD8RNbOy3XsAljm6T8YYY8zTaNGH3RFAohDiuBAiF8A8AMMsbDcGwAIAqRrskzHGGPMoWiTs2gBOm91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jLkM92Ezxky2CyFSAICIjgEwLRu4F0Bv4+1+AJoZy4ICQGUiCjGuic4YcyJO2Iwxkxyz24Vm9wtx41jhBaCLEOK6KwNjjHGTOGOsYpYDGG26Q0RtJMbCmEfhhM0Yq4jnAcQQ0R4iOgDgadkBMeYpeFoXY4wxpgN8hc0YY4zpACdsxhhjTAc4YTPGGGM6wAmbMcYY0wFO2IwxxpgOcMJmjDHGdIATNmOMMaYDnLAZY4wxHfh/1AO/9OojnyIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8, 3))\n",
    "librosa.display.waveplot(x, sr=fs)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Args():\n",
    "    pass\n",
    "args = Args()\n",
    "args.speed = 1\n",
    "args.frame_period = 5.0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "直接合成"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "_f0, t = pw.dio(x, fs, f0_floor=50.0, f0_ceil=600.0,\n",
    "                channels_in_octave=2,\n",
    "                frame_period=args.frame_period,\n",
    "                speed=args.speed)\n",
    "_sp = pw.cheaptrick(x, _f0, t, fs)\n",
    "_ap = pw.d4c(x, _f0, t, fs)\n",
    "_y = pw.synthesize(_f0, _sp, _ap, fs, args.frame_period)\n",
    "soundfile.write('./data/demo_without_f0_refinement.wav', _y, fs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<audio  controls=\"controls\" src=\"./data/demo_without_f0_refinement.wav\" ></audio>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "加8度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "_f0 = _f0 * 8\n",
    "_y = pw.synthesize(_f0, _sp, _ap, fs, args.frame_period)\n",
    "soundfile.write('./data/demo_with_f0_8.wav', _y, fs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<audio  controls=\"controls\" src=\"./data/demo_with_f0_8.wav\" ></audio>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
